package org.anddev.andengine.extension.svg.node;
/**
 * @author Eric Depta
 * @since 01:14:00 - 28.02.2011
 */
import java.util.ArrayList;
import java.util.List;

import org.anddev.andengine.extension.svg.SVGDoc;
import org.anddev.andengine.extension.svg.SVGPath;
import org.anddev.andengine.extension.svg.util.transform.TransformDoc;
import org.anddev.andengine.util.SAXUtils;
import org.xml.sax.Attributes;

import com.badlogic.gdx.math.Vector2;

public class LineNode extends PathNode {
	
	public LineNode(final SVGDoc pSVGDoc){
		super(pSVGDoc);
	}
	
	public void create(final Attributes pAttributes, final TransformDoc pTransform){
		super.create(pAttributes, pTransform);
	}
	
	@Override
	protected void createPath(final Attributes pAttributes){
		List <Vector2> line = new ArrayList<Vector2>();
		line.add(new Vector2(SAXUtils.getFloatAttribute(pAttributes, TAG_ATTRIBUTE_X1, 0), SAXUtils.getFloatAttribute(pAttributes, TAG_ATTRIBUTE_Y1, 0)));
		line.add(new Vector2(SAXUtils.getFloatAttribute(pAttributes, TAG_ATTRIBUTE_X2, 0), SAXUtils.getFloatAttribute(pAttributes, TAG_ATTRIBUTE_Y2, 0)));
		this.svgPath = new SVGPath(
			line,
			false
		);
	}

}
